#ifndef MAIN_H
#define MAIN_H

#define CLI_IPUT_SIZE       1024        // CLI comman line interface
#define CLI_MAX_AGR_COUNT   10

#define ESC_CMD2(Pn, cmd)               "\x1b["#Pn#cmd
#define ESC_CLEAR_SCREEN                ESC_CMD2(2, J)
#define ESC_COLOR_ERROR                 ESC_CMD2(31, m)
#define ESC_COLOR_DEFUALT               ESC_CMD2(39, m)
#define ESC_MOVE_CURSOR(row, col)       "\x1b["#row";"#col"H"


typedef struct _cli_cmd_t {
    const char *name;
    const char *usage;
    int (*do_func)(int argc, char **argv);
} cli_cmd_t;

typedef struct _cli_t {
    char curr_input[CLI_IPUT_SIZE];
    const cli_cmd_t *cmd_start;
    const cli_cmd_t *cmd_end;
    const char *promot;                     // 命令行提示
} cli_t;


#endif